package com.liu.repository;

import com.liu.domain.VoteLimit;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import javax.transaction.Transactional;

/**
 * Created by liu on 17-11-6.
 */
public interface VoteLimitRepository extends JpaRepository<VoteLimit, Integer> {

    @Query("select v from VoteLimit v where v.stuId = ?1 and v.topicId = ?2")
    VoteLimit isVoted(String stuId, int topicId);

//清空表内数据
    @Transactional
    @Modifying
    @Query("delete from VoteLimit ")
    int del();
}
